#pragma once
#include "../common/CLog.h"
#include "../common/ConfigOpe.h"
#include "../common/CSync.h"
#include "Script.h"
#include "../common/MsgQueue.h"

using namespace script;

class CDataConvert
{
public:
	CDataConvert(void);
	~CDataConvert(void);

	bool Run(OUT bool& isRunning);

private:
	bool LoadConfigInfo();
	void CreateVarList();
	void CopyType2ToShm();
	bool ParseConvertCmd();
	bool CreateConvertThread();
	static int RunConvertThread(void* lpVoid);
	int ConvertThread();	
	tagVarType1* FindTheVar(const wstring& strVarName);

	bool FlushValueToList();

private:
	CLog myLog;
	GlobalInstrumentInfo myInstrumentInfo;	

	vector <tagVarType1*> pType1List;
	vector <tagVarType2*> pType2List;
	vector <tagVarType3*> pType3List;

	CSync syncType1;
	CSync syncType2;
	CSync syncType3;	

	map <wstring, float> varValueList;
	CMsgQueue myMsgQueue;
};
